<template>
  <!--Popup-->
  <view class="Popup">
    <u-popup :show="isPopup" :round="15" mode="bottom" @close="close" :closeable="showClose" safe-area-inset-bottom>
      <view class="title">{{ title }}</view>
      <slot></slot>
      <view class="footer fs_0">
        <view class="confirm btn" @click="confirm" v-if="showConfirmBtn">{{ confirmBtnLabel }}</view>
        <view class="line" v-if="showCloseBtn"></view>
        <view class="close btn" @click="close" v-if="showCloseBtn">{{ closeBtnLabel }}</view>
      </view>
    </u-popup>
  </view>
</template>
<script>
export default {
  name: "Popup",
  props: {
    title: {
      type: String,
      default: "温馨提示"
    },
    showClose: {
      type: Boolean,
      default: true,
    },
    showCloseBtn: {
      type: Boolean,
      default: true,
    },
    showConfirmBtn: {
      type: Boolean,
      default: true,
    },
    closeBtnLabel: {
      type: String,
      default: "取消",
    },
    confirmBtnLabel: {
      type: String,
      default: "确定",
    }
  },
  data() {
    return {
      isPopup: false,
    }
  },
  methods: {
    close() {
      this.isPopup = false;
      this.$emit("close")
    },
    open() {
      this.isPopup = true;
    },
    confirm() {
      this.$emit("confirm")
    }
  }
}
</script>
<style scoped lang="scss">
.Popup {

  ::v-deep .u-popup__content {
    width: 100vw;
    max-height: 85vh;
    overflow-y: scroll;
    flex: inherit !important;
  }

  .title {
    color: #333333;
    font-size: 32rpx;
    font-weight: bold;
    text-align: center;
    height: 75px;
    line-height: 75px;
    border-bottom: 1px solid #EEEEEE;
  }

  .btn {
    height: 74px;
    text-align: center;
    line-height: 74px;
    color: #000000;
    font-size: 14px;
  }

  .line {
    width: 100%;
    background-color: #F2F2F2;
    height: 6rpx;
  }
}
</style>